<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?><!DOCTYPE html>
<html lang="ru">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="/favicon.ico">

        <title><?php echo (isset($title)?$title:$this->config->item('app_title')); ?></title>

        <!-- Bootstrap core CSS -->
        <link href="/assets/css/bootstrap.min.css" rel="stylesheet">
        
        <!-- JQuery UI CSS-->
        <link href="/assets/css/jquery-ui.min.css" rel="stylesheet">
        
        <!-- Font Awesome ICON -->
        <link href="/assets/css/font-awesome.min.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="/assets/css/style.css" rel="stylesheet">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <!-- Navigation -->
        <div class="navbar-sm">
            <div class="navbar-primary">
                <div class="navbar navbar-fixed-top navbar-default">
                    <div class="container">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-menu">
                                <span class="sr-only">Открыть меню</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            <a class="navbar-brand" href="/">Статистика</a>
                        </div>

                        <div class="collapse navbar-collapse" id="main-menu">
                            <ul class="nav navbar-nav">
                                <!--<li><a href="#" data-toggle="modal" data-target="#modalGroup"  data-toggle="tooltip" data-original-title="Default tooltip"><i class="glyphicon glyphicon-plus"></i> Добавить группу</a></li>-->
                                <li><a href="#" data-toggle="modal" data-target="#modalConfig"><i class="glyphicon glyphicon-cog"></i> Настройки</a></li>
                            <?php // if ($this->session->userdata['role'] == $this->config->item('admin_role_id')): ?>
                            <?php if ($this->role_model->isAdminRole()): ?>
                                <li><a href="/admin"><i class="glyphicon glyphicon-bell"></i> Админка</a></li>
                            </ul>
                            <form class="navbar-form navbar-left" role="search" action="/main/search" method="post">
                                <div class="input-group">
                                    <input type="text" id="search" name="search" class="form-control input-sm" autocomplete="off" value="<?php echo @$_POST['search']; ?>" required>
                                    <span class="input-group-btn">
                                        <button class="btn btn-default input-sm" type="submit" name="btnSearch"><span class="glyphicon glyphicon-search"></span></button>
                                    </span>
                                </div>
                            </form>
                            <?php else: ?>
                            </ul>
                            <?php endif; ?>
                            <ul class="nav navbar-nav navbar-right col-lg-4">
                                <p class="navbar-text"><span class="hidden-xs hidden-sm hidden-md">Пользователь &nbsp;</span>&nbsp;<span class="glyphicon glyphicon-user"></span> <strong><?php echo $username; ?></strong></p> 
                                <li class=""><a href="/user/logout">Выход</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div> <!-- End Navigation -->

        <!-- Container -->
        <a name="topanchor"></a>
        <div id="alert-container">
            
        </div>
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <h3>Результаты поиска</h3>
                </div>
            </div>
        </div> <!-- END Container -->
        <!-- Container -->
        <div class="container" id="search-container">
            <div class="row">
                <div class="col-sm-12">
                    <?php echo $search_content; ?>
                </div>
            </div>
        </div> <!-- END Container -->

        <!-- Modals -->
        <!-- Modal Configs -->
        <div class="modal fade" id="modalConfig">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Закрыть</span></button>
                        <h4 class="modal-title">Настройки</h4>
                    </div>
                    <form class="form-horizontal" role="form" id="formConfig">
                        <div class="modal-body col-sm-offset-1">
                            <h4>Показывать графики за</h4>
                            <div class="col-sm-offset-1">
                            <?php foreach ($this->config->item('form_chart_period') as $per_key => $per_val): ?>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="period[]" value="<?php echo $per_key; ?>">
                                    <?php echo $per_val; ?>
                                </label>
                            <?php endforeach; ?>
                            </div>

                            <h4>Дополнительные опции</h4>
                            <?php foreach ($this->config->item('chart_mode') as $mode_key => $mode_ary): ?>
                            <div class="checkbox col-sm-offset-1">
                                <label>
                                    <input type="checkbox" name="chartmode[]" value="<?php echo $mode_key; ?>">
                                    <?php echo $mode_ary[1]; ?>
                                </label>
                            </div>
                            <?php endforeach; ?>

                            <h4>Размер графиков</h4>

                            <div class="form-group form-group-sm">
                                <label for="inputWidth" class="control-label col-sm-3 col-sm-offset-1">Ширина</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="inputWidth" placeholder="Ширина">
                                </div>
                            </div>
                            <div class="form-group form-group-sm">
                                <label for="inputHeight" class="control-label col-sm-3 col-sm-offset-1">Высота</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="inputHeight" placeholder="Высота">
                                </div>
                            </div>
                            <h4>Использовать превью <input type="checkbox" id="chartprev" name="chartprev"></h4>
                            <fieldset name="prevfields">
                                <div class="form-group form-group-sm">
                                    <label for="inputWidthPreview" class="control-label col-sm-4 col-sm-offset-0">Ширина превью</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" id="inputWidthPreview" placeholder="Ширина превью">
                                    </div>
                                </div>
                                <div class="form-group form-group-sm">
                                    <label for="inputHeightPreview" class="control-label col-sm-4 col-sm-offset-0">Высота превью</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" id="inputHeightPreview" placeholder="Высота превью">
                                    </div>
                                </div>
                            </fieldset>
                            <h4>Период обновления</h4>
                            <div class="form-group form-group-sm">
                                <label for="selectChartReload" class="control-label col-sm-3 col-sm-offset-1">Интервал</label>
                                <div class="col-sm-3">
                                    <select class="form-control" name="reloadchart" id="selectChartReload">
                                        <?php foreach ($this->config->item('chart_reload') as $rel_key => $rel_val): ?>
                                        <option value="<?php echo $rel_key; ?>"><?php echo $rel_val; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
                            <button type="button" class="btn btn-primary">Сохранить</button>
                        </div>
                    </form>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
        
        <!-- to top -->
        <a id="toTop" style="right: -1px; display: none;" class="hand">
            <img id="gh-bti" border="0" width="33" height="76" alt="Scroll to top" src="/images/btt.png" title="К началу страницы">
        </a>
        
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="/assets/js/jquery-1.11.1.min.js"></script>
        <!-- jQuery UI -->
        <script src="/assets/js/jquery-ui.min.js"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="/assets/js/bootstrap.min.js"></script>
        <script src="/assets/js/bootstrap-growl.min.js"></script>
        <!-- Main Scripts -->
        <script src="/assets/js/main-scripts.js"></script>
    </body>
</html>